package com.poetize.plus.entity.vo;

import com.poetize.plus.entity.po.Barrage;
import io.swagger.v3.oas.annotations.media.Schema;

/**
 * @author zuosy
 * @created 2024/5/14 14:23
 */
public record BarrageVO(

        @Schema(description = "ID")
        Long id,

        @Schema(description = "头像")
        String avatar,

        @Schema(description = "弹幕内容")
        String content
) {

    /**
     * 实体类转VO
     *
     * @param barrage
     * @return
     */
    public static BarrageVO convert(Barrage barrage, String avatar) {
        return new BarrageVO(barrage.getId(), avatar, barrage.getContent());
    }

}
